package com.xinyue.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.ApplicationContext;
import com.xinyue.gateway.server.GameGatewayBootServer;

@SpringBootApplication(scanBasePackages = {"com.xinyue"})
@EnableEurekaServer
public class GameGateWayMain {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(GameGateWayMain.class);
        app.setWebApplicationType(WebApplicationType.NONE);
        ApplicationContext applicationContext = app.run(args);
        
        Thread start = new Thread(() -> {
            GameGatewayBootServer gameGatewayServer = applicationContext.getBean(GameGatewayBootServer.class);
            gameGatewayServer.init();
            // 启动服务
            gameGatewayServer.startServer();
        });
        start.start();
    }
    
}
